#!/usr/bin/env python
# -*- coding: utf-8 -*-

from multiprocessing import Process,Semaphore
import time,random

def go_wc(sem,user):
    sem.acquire()
    time.sleep(random.randint(0,3)) # 模拟每个人拉屎速度不一样，0代表有的人蹲下就起来了
    sem.release()


if __name__ == '__main__':
    sem=Semaphore(5)
    p_l=[]
    for i in range(13):
        p=Process(target=go_wc,args=(sem,'user%s' %i,))
        p.start()
        p_l.append(p)

    for i in p_l:
        i.join()
    print('============》')
